

import org.powerbot.core.script.job.Task;
import org.powerbot.core.script.job.state.Node;
import org.powerbot.game.api.methods.Settings;
import org.powerbot.game.api.methods.Widgets;
import org.powerbot.game.api.methods.input.Keyboard;
import org.powerbot.game.api.methods.input.Mouse;
import org.powerbot.game.api.methods.interactive.NPCs;
import org.powerbot.game.api.methods.interactive.Players;
import org.powerbot.game.api.methods.node.GroundItems;
import org.powerbot.game.api.methods.node.Menu;
import org.powerbot.game.api.methods.tab.Inventory;
import org.powerbot.game.api.methods.widget.Camera;
import org.powerbot.game.api.util.Random;
import org.powerbot.game.api.util.Timer;
import org.powerbot.game.api.wrappers.interactive.NPC;
import org.powerbot.game.api.wrappers.interactive.Player;
import org.powerbot.game.api.wrappers.node.GroundItem;
import org.powerbot.game.api.wrappers.widget.Widget;
import org.powerbot.game.api.wrappers.widget.WidgetChild;


public class Combat extends Node{

	@Override
	public boolean activate() {
		return Players.getLocal() != null 
				&& NPCs.getNearest(FireGiant.fireGiants) != null
				&& !Players.getLocal().isInCombat();
	}
	//add timer for each EoC skill, wait for cooldowns before attempting to cast each.
	//rejuv = 60
	//slice = 3
	//punish = 5
	//global = 2
	//add shield swapping capabilities for when able to cast skill.
	//check mobs hp before casting ult
	//
	
	@Override
	public void execute() {
		final NPC enemy = NPCs.getNearest(FireGiant.fireGiants);
		final Player p = Players.getLocal();
		if(p.getInteracting() == null )
		{
			Attack(enemy);
		}
		
	}
	
	public void Attack(NPC enemy)
	{
		if(enemy.isOnScreen()) 
		{
			if(!enemy.isInCombat())
			{
				//System.out.println(enemy.getHpRatio());
			}
		
				if(Random.nextInt(0, 7) % 2 == 0) 
				{
					if(enemy.click(false) && Menu.isOpen() && Menu.contains("Attack")) 
					{
						Menu.select("Attack");
						Task.sleep(300);
					}
				} 
				else 
				{
					enemy.interact("Attack", "Fire giant");     
					Task.sleep(300);
				}      
				FireGiant.currNpc = enemy;
			
		}
		else 
		{
			Camera.turnTo(enemy);
		}
	}
}